<?php
/**
 * AdminCategory
 * Created by Veyron
 * motto:现在的拼搏 为了更好的明天
 * day:  2020/2/6
 * Time: 22:06
 */

namespace app\admin\validate;

use think\Validate;

class Category extends Validate
{
    protected $rule = [
        'id'   => 'require|integer',
        'pid'  => 'require|integer',
        'name' => 'require|unique:category'
    ];
    protected $message = [
        'id.require'   => 'ID不能为空',
        'id.integer'   => 'ID必须是数字',
        'pid.require'  => '父类ID不能为空',
        'pid.integer'  => '父类ID必须是数字',
        'name.require' => '分类名不能为空',
        'name.unique'  => '分类名已存在',
    ];
    protected $scene = [
        'edit' => ['id','pid','name'],
        'save' => ['pid','name']
    ];
}
